<!doctype html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta name="description" content="">
  <meta name="author" content="Mark Otto, Jacob Thornton, and Bootstrap contributors">
  <meta name="generator" content="Hugo 0.88.1">
  <title>Employee Page</title>
  <!-- <link rel="canonical" href="https://getbootstrap.com/docs/5.1/examples/dashboard/">-->
  <!-- Bootstrap core CSS -->
  <link th:href="@{/css/bootstrap.min.css}" rel="stylesheet">

  <style>
    .bd-placeholder-img {
      font-size: 1.125rem;
      text-anchor: middle;
      -webkit-user-select: none;
      -moz-user-select: none;
      user-select: none;
    }

    @media (min-width: 768px) {
      .bd-placeholder-img-lg {
        font-size: 3.5rem;
      }
    }
  </style>


  <!-- Custom styles for this template -->
  <link  th:href="@{/css/dashboard.css}" rel="stylesheet">
</head>
<body>
<div th:insert="~{frontpage::headtop}"></div>

<div class="container-fluid">
  <div class="row">
    <div th:insert="~{frontpage::textmenu(activeUri='employee/findByPage')}"></div>

    <main class="col-md-9 ms-sm-auto col-lg-10 px-md-4">
      <h2>员工信息</h2>
      <div class="col-md-12">
      <p>导入员工列表</p>
      <form th:action="@{/employee/import}" method="post" enctype="multipart/form-data" class="form-inline">
        <div class="from-group">
          <input class="form-control" type="file" name="excelFile" >
          <input type="submit" class="btn btn-danger" value="导入数据">
        </div>
      </form>
      </div>
      <!--模糊查询-->
      <from>
      <input type="text" name="name" placeholder="输入需要查询的内容" />
      <input type="submit" value="搜索" />
      </from>
      <div class="table-responsive">
        <table class="table table-striped table-sm">
          <thead>
          <th scope="col">编号</th>
          <th scope="col">姓名</th>
          <th scope="col">照片</th>
          <th scope="col">薪资</th>
          <th scope="col">部门</th>
          <th scope="col">入职日期</th>

          <th scope="col">性别</th>
          <th scope="col">电话</th>
          <th scope="col">邮箱</th>
          <th scope="col" th:if="${session.user!=null}">操作</th>
          <!--<td th:if="${session.user!=null}">
              操作
          </td>-->
          <tbody>
          <tr th:each="employee,state:${employees}" class="row1">
            <td th:text="${employee.id}"></td>
            <td th:text="${employee.name}"></td>
            <td ><img th:src="@{/}+${employee.photo}" width="60"></td>
            <td th:text="${employee.salary}"></td>
            <td th:text="${employee.departmentName}" ></td>
            <td th:text="${#dates.format(employee.birthday,'yyyy/MM/dd')}"></td>
            <td th:text="${employee.gender==true?'男':'女'}"></td>
            <td th:text="${employee.telephone}"></td>
            <td th:text="${employee.epemail}"></td>
            <td th:if="${session.user!=null}">
              <a href="javascript:;"  th:onclick="'deleteEmployee('+${employee.id}+')'">删除</a>
              <!--<a th:href="@{/user/findByPage/detail?id=}+${user.id}">更新</a>-->
              <a th:href="@{/employee/detail(id=${employee.id})}">更新</a>
            </td>
          </tr>
          <script>
            function deleteEmployee(id){
              console.log(id)
              if (window.confirm('确定要删除记录嘛')){
                location.href='[[@{/employee/delete?id=}]]' +id;
              }
            }
          </script>


          <!-- 首页'/findByPage?pageNow=0' -->

          <a th:href="@{/adde}">添加员工</a>
          </tbody>
          <thead>
          <div style="float:right">
          <a th:href="@{/employee/export}">导出excel</a>
          </div>
        </table>
        <div id="page1">
          <a th:href="@{'/employee/findByPage?pageNow=1&pageSize=4'}">首页</a>
          <!-- 上一页-->
          <a th:href="@{'/employee/findByPage?pageNow='+${start-1}}+'&pageSize=4'"> 上一页</a>
          <a th:href="@{'/employee/findByPage?pageNow='+${start+1}}+'&pageSize=4'">下一页</a>
          共:<span th:text="${total}/4">页</span>
        </div>
        <div id="footer">
          <div id="footer_bg">
            Personnel management procedures
          </div>
        </div>
      </div>
    </main>
  </div>
</div>
</body>
</html>
      <!--<tr>
      <label th:if="${session.user!=null}">添加新员工
        <input type="button" class="button" value="添加" onclick="addEmp()"/>
        &lt;!&ndash;执行函数&ndash;&gt;
      </label>
         <label th:if="${session.user==null}">员工信息</label>
       </tr>
        <script>
          function addEmp(){
            location.href='/ems-thymeleaf/addEmp';
          }
        </script>-->

      <!--<table class="table">
        <tr class="table_header">
          <td>
            编号
          </td>
          <td>
            姓名
          </td>
          <td>
            头像
          </td>
          <td>
            收入
          </td>
          <td>
            所属部门
          </td>
          <td>
            入职日期
          </td>
          <td>
            性别
          </td>
          <td>
            电话
          </td>
          <td>
            电子邮箱
          </td>

          <td th:if="${session.user!=null}">
            操作系统
          </td>

        <tr th:each="employee,state:${employees}" class="row1">
          <td>
            <span th:text="${employee.id}"></span>
          </td>
          <td>
            <span th:text="${employee.name}"></span>
          </td>
          <td>
            <img th:src="@{/}+${employee.photo}" width="60">
          </td>
          <td>
            <span th:text="${employee.salary}"></span>
          </td>
          <td>
            <span th:text="${employee.departmentName}"></span>
          </td>
          <td>
            <span th:text="${#dates.format(employee.birthday,'yyyy/MM/dd')}"></span>
          </td>
          <td>
            <span th:text="${employee.gender==true?'男':'女'}"></span>
          </td>
          <td>
            <span th:text="${employee.telephone}"></span>
          </td>
        <td>
          <span th:text="${employee.epemail}"></span>
        </td>

          <td th:if="${session.user!=null}">

            <a href="javascript:;" th:onclick="'deleteEmployee('+${employee.id}+')'">删除</a>
            &lt;!&ndash;<a th:href="@{/employee/detail?id=}+${employee.id}">更新</a>&ndash;&gt;
            <a th:href="@{/employee/detail(id=${employee.id})}">更新</a>
          </td>
        </tr>
        <script>
          function deleteEmployee(id){
            console.log(id)
            if (window.confirm('确定要删除记录嘛')){
              location.href='[[@{/employee/delete?id=}]]' +id;

            }
          }
        </script>


        <td>
          <a th:href="@{'/employee/findByPage?pageNow=1&pageSize=4'}">首页</a>
        </td>
        &lt;!&ndash; 上一页&ndash;&gt;
        <td>
          <a th:href="@{'/employee/findByPage?pageNow='+${start-1}}+'&pageSize=4'"> 上一页</a>
        </td>
        <td>
          <a th:href="@{'/employee/findByPage?pageNow='+${start+1}}+'&pageSize=4'">下一页</a>
        </td>
        <td>
          共:<span th:text="${total}">页</span>
        </td>
      </table>
    </div>
  </div>

  <div id="footer">
    <div id="footer_bg">
      Personnel management procedures
    </div>
  </div>
</div>


</body>

</html>-->